<script type="text/javascript" charset="utf-8">
    var error = {
        parent: {
            minlength: '<?php __('Please enter a main category group.'); ?>',
            maxlength: '<?php __('This must not longer than 100 characters'); ?>'
        },
        category: {
            minlength: '<?php __('Please enter category name.'); ?>',
            maxlength: '<?php __('This must be no larger than 100 characters long.'); ?>'
        }
    };

    function formSaved () {
        $('AdCategoryCategory').clear().focus();
        new Effect.Fade('messageBox', { delay:3, afterFinish:function(){ $('messageBox').remove(); } });
    } // formSaved
</script>

<div class="form">
<?php
    echo $form->create(
        'AdCategory', array(
            'action'   => 'axAdd',
            'onsubmit' => 'event.returnValue=false; return postForm(this, { reset:false, onComplete:formSaved });'
        )
    );
?>
  <table id="form-table">
    <tr>
      <td class="label"><?php __('Main Category'); ?>:</td>
      <td class="input"><?php echo $form->input('AdCategory.parent', array('label'=>false)); ?></td>
    </tr>
    <tr>
      <td class="label"><?php __('Sub Category'); ?>:</td>
      <td class="input"><?php echo $form->input('AdCategory.category', array('label'=>false)); ?></td>
    </tr>
    <tr>
      <td></td>
      <td><?php echo $form->submit(__('Add',true), array('div'=>false)); ?></td>
    </tr>
  </table>
<?php
    echo $form->end();
?>
</div>
<div class="actions">
    <ul>
<?php if ($this->action == 'edit'):?>
        <li><?php echo $html->link(__('Delete', true), array('action'=>'delete', $form->value('AdCategory.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('AdCategory.id'))); ?></li>
<?php endif;?>
        <li><?php echo $html->link(__('List AdCategories', true), array('action'=>'index'));?></li>
        <li><?php echo $html->link(__('List Ad Posts', true), array('controller'=> 'ad_posts', 'action'=>'index')); ?> </li>
    </ul>
</div>